<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script src="${pageContext.request.contextPath}/JS/jquery3.3.1.js"></script>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-theme.min.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/JS/bootstrap.min.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="${pageContext.request.contextPath }/JS/jquery-1.11.0.min.js"></script>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <link href="${pageContext.request.contextPath }/css/flowersingle.css" rel="stylesheet" type="text/css" />
<title>商品维护</title>
<style type="text/css">
div{
float:left;
}
</style>
</head>
<body>
<%@ include file="/com/top.jsp" %>
<%@ include file="/com/top1.jsp" %>


<div id = "my_upload" class = "" style = "min-width:1349px;">

<div id = "" class = "" style = "float:left;margin-right: 2px;">
	<%@ include file="/com/left.jsp" %>	
</div>


<!-- 中间 -->
<div id = "" class = "" style = "height:700px;width:1193px;">

<!-- 标题开始 -->
	<div id = "" class = "font_color" style = "width: 100%;height:60px;font-weight: bold;
	text-align: center;background-color: #2e2e2e;">
		<div id = "" class = "" style = "width:100%;">维护商品</div>
		<div id = "" class = "" style = "height:30px;margin-left: 45%;">
			<div id = "" class = "cycle" style = "width:30px;height:30px;">
				<img alt=""  src="${pageContext.request.contextPath}${shop.shophead}">
			</div>
			<div id = "" class = "" style = "height:30px;line-height: 30px;margin-left: 10px;font-size:12px;font-weight:bold;color:#ff3535">
				${shop.shopname }
			</div>
		</div>
	</div><!-- 标题结束 -->
	
	<div style = "width:1070px;"><!-- 附加 -->
	<div id = "" class = "font_color" style = "width:90%;text-align: right;">
	<a href= "#" onclick="$('#my_updown_out').css('display','block')" class = "font_color" style = "">
		<input type = "button" id = "" class = "btn btn-default btn-sm font_color" name = "" 
	style = "font-weight: bold;" value = "上架商品" onclick="">
	</a>
	</div>
	
<!-- 	表格开始 -->
	<div id = "" class = "" style = "height:580px;;margin: 2px;">
		<table class = "table table-hover table-bordered">
		  <tr>
		    <th>图片</th>
		    <th>名称</th>
		    <th>价格</th>
		    <th>详细描述</th>
		    <th>所属类型</th>
		    <th>库存</th>
		    <th>下架</th>
		  </tr>
		  
		  <c:forEach items="${commoditys }" var = "n">
		  	<tr>
		    <td>
				<div id = "" class = "" style = "width:120px;height:120px;">
					<img alt="" src="${pageContext.request.contextPath}${n.img}" style = "width:100%;height:100%;">
				</div>
			</td>
		    <td style = "min-width:120px;">${n.cmdyname }</td>
		    <td style = "width:120px;color:red;font-weight: bold;font-size: 19px;">${n.price }￥</td>
		    <td style = "">
		    	<div id = "" class = "" style = "width:300px;height:120px;overflow: hidden;word-break:break-all; ">
					${n.detail }
		    	</div>
		    </td>
		    <td style = "width:120px;">${n.type }</td>
		    <td style = "width:120px;">${n.inventory }</td>
		    <td style = "width:120px;"><a href = "#" onclick = "deleteCommodity(this)" name = "${n.cmdyid }">下架</a></td>
		  </tr>
		  </c:forEach>
		  
		</table>

	
	</div><!-- 	表格结束 -->
	</div><!-- 附加结束 -->
	
	<div id = "" class = "" style = "background-color: #2e2e2e;width:115px;height:1000px;margin: 4px;">
		
	</div>
	
	
</div><!-- 总的结束 -->




<script type="text/javascript">


$(function(){
	$("#left_updown a").addClass("font_color")
})

	function deleteCommodity(src){
		var cmdyid = src.name;
		$.ajax({
            url:"${pageContext.request.contextPath}/DownCommodityServlet",
            async:false,
            type:"post",
            data:{'cmdyid':cmdyid},
            dataType:"json",
            success:function(d){
            	if(d.msg==1){
            		alert("下架成功")
            		window.location.reload();
            	}else{
            		alert("下架失败")
            	}
            }
        });
	}
</script>






</div>
<%@ include file="/a/updown_out.jsp" %>
</body>
</html>